<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<link rel="stylesheet" href="css/center.css" type="text/css">
<%-- <script type="text/javascript" src="jquery.validate-1.13.1.js"></script>
<script type="text/javascript" src="MyDatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="js/validator.js"></script> --%>
</head>
<body>
	<s:if test="#attr.msg=='yes'">
		<script>
			alert("操作成功");
		</script>
	</s:if>
	
	<div
		style="width: 970px;height: 40px;margin-top: 10px;margin-left: 170px;"></div>
	<div id="main" style="height: 800px;">
		<div class="mainleft">
			<ul>
				<li class="select"><a href="javascript:void(0);">商家信息 </a></li>
				<li><a href="javascript:void(0);">已发布广告</a></li>
				<li><a href="javascript:void(0);">要完成的任务</a></li>
				<li><a href="javascript:void(0);">已完成的任务 </a></li>
				<li><a href="javascript:void(0);">发布广告 </a></li>
			</ul>
		</div>
		<div class="mainright">
			<div class="content" style="display: block;">
				<h3>商家信息</h3>
				<div id="showCompanyInfo" style="display: block;margin-top: 20px;">
					<ul>
						<li>商&nbsp;家&nbsp;名:${company.companyName }</li>
						<li>已绑定电子邮箱:${company.companyEmail}</li>
						<li>负&nbsp;责&nbsp;人:${company.companyManager}</li>
						<li>联系电话:${company.companyTel}</li>
						<li>商家地址:${company.companyAddress}</li>
						<li>信&nbsp;用&nbsp;值:${company.creditPoint}</li>
						<li><input type="button" value="修改资料"
							class="buttonupdateInfo" id="updateCompanyInfoButton"> <input
							type="button" value="修改密码" class="buttonupdatePassword"
							id="updateCompanyPasswordButton"></li>
					</ul>
				</div>
				<div id="updateCompanyPassword"
					style="display: none;margin-top: 50px;">
					<form action="company_updatePassword?id=${company.companyId}"
						id="updateCompanyPasswordForm" method="post">
						<ul>
							<li>请输入原密码:&nbsp;&nbsp;&nbsp;&nbsp;<input type="password"
								name="usedPassword"></li>
							<li>请输入新密码:&nbsp;&nbsp;&nbsp;&nbsp;<input type="password"
								name="company.companyPassword"></li>
							<li>请再次输入新密码:<input type="password" name="confirmPassword">
							</li>
							<li><input type="reset" value="重置内容" class="buttonReset">
								<input type="submit" value="确认修改" class="buttonSubmit">
								<input type="button" value="返回" class="buttonReturn"
								id="returnButton">
							</li>
						</ul>
					</form>
				</div>
				<div id="updateCompanyInfo" style="display: none;margin-top: 50px;">
					<form action="company_updateInfo?id=${company.companyId}"
						id="updateCompanyInfoForm" method="post">
						<ul>
							<li>联系电话:<input type="text" name="company.companyTel"
								value="${company.companyTel}"></li>
							<li>商家地址:<input type="text" name="company.companyAddress"
								value="${company.companyAddress}"></li>
							<li>负责人:<input type="text" name="company.companyManager"
								value="${company.companyManager}"></li>
							<li><input type="reset" value="重置内容" class="buttonReset">
								<input type="submit" value="确认修改" class="buttonSubmit">
								<input type="button" value="返回" class="buttonReturn"
								id="returnButton">
							</li>
						</ul>
					</form>
				</div>
			</div>
			<div class="content" style="display: none;">
				<div id="showUserTextCompanysend" style="display: block;">
					<h3>已发布的广告</h3>
					<s:if test="#session.normalAds!=null&&#session.disCheckAds!=null">
						<s:iterator value="#session.normalAds" var="t">
							<span class="en">有效广告</span>
							<table style="border-bottom: 1px dotted;width: 520px;">
								<tr>
									<td>广告内容:${text}<br>有效截止至:<fmt:formatDate
											value="${limiteDate}" pattern="yyyy-MM-dd HH:mm" />
									</td>
									<s:if test="#t.image!=null&&#t.image!='no'">
										<td style="width: 280px;" align="center"><img alt=" "
											src="${image}" style="width: 100px;height: 120px">
										</td>
									</s:if>
									<s:else>
										<td></td>
									</s:else>
								</tr>
							</table>
						</s:iterator>
						<s:iterator value="#session.disCheckAds" var="t">
							<span class="en">待审核广告</span>
							<table style="border-bottom: 1px dotted;width: 520px;">
								<tr>
									<td>广告内容:${text}<br> 有效截止至:<fmt:formatDate
											value="${limiteDate}" pattern="yyyy-MM-dd HH:mm" />
									</td>
									<s:if test="#t.image!=null&&#t.image!='no'">
										<td style="width: 280px;" align="center"><img alt=" "
											src="${image}" style="width: 100px;height: 120px">
										</td>
									</s:if>
									<s:else>
										<td></td>
									</s:else>
								</tr>
								<tr style="height: 10px;"></tr>
								<tr>
									<td align="right" colspan="2"><a
										href="bothtext_deleteAdBycompany?id=${textId}"
										class="buttonDeleteText">删除</a>&nbsp;&nbsp;<a
										class="buttonUpadateText" id="buttonUpdateAd" onclick="updateAd(${textId});return false;">修改</a></td>
								</tr>
							</table>
						</s:iterator>
					</s:if>
					<s:else>
						<ul>
							<li>暂无发布广告</li>
						</ul>
					</s:else>
				</div>
				<div id="updateAd" style="display:none;">
					<h3>广告修改</h3>
					<form action="bothtext_updateText" id="updateAdForm" method="post"
						enctype="multipart/form-data" class="Form"
						style="margin-top: 30px;width: 480px;">
						<ul>
							<li>广告内容:</li>
							<li><textarea name="bothText.text" id="TextArea1"
									onkeyup="checkLength120(this);"
									style="width:470px;height:100px;">
								</textarea></li>
							<li style="margin-top: 90px;"><span class="wordage">剩余字数：<span
									id="sy" style="color:Red;">120</span> </span>
							</li>
							<li style="margin-bottom: 5px;">有效期选择:<input type="text"
								onClick="WdatePicker()"
								onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:'%y-%M-%d %H:{%m+10}',maxDate:'{%y+1}-%M-%d %H:%m',realDateFmt:'yyyy-MM-dd HH:mm'})"
								style="width: 150px;" name="limitday">
							</li>
							<li>所上传的图片:</li>
							<li><input type="file" name="image"></li>
							<li></li>
							<li><img alt="" name="image" src="" id="img"
								style="width: 100px;height: 120px;margin-left: 100px;">
							</li>
							<li><input type="hidden" name="bothText.image">
							</li>
							<li><input type="reset" value="重置内容" class="buttonReset">
								<input type="submit" value="确认修改" class="buttonSubmit">
								<a href="company_initCompany" class="buttonReturn">返回</a></li>
							<li><input type="hidden" name="bothText.textId">
							</li>
							<li><input type="hidden" name="bothText.tag">
							</li>
							<li><input type="hidden" name="bothText.sendId">
							</li>
						</ul>
					</form>
				</div>
			</div>
			<div class="content" style="display: none;">
				<h3>要完成的任务</h3>
				<s:if
					test="#session.userTextCompanyUndo!=null&& !#session.userTextCompanyUndo.isEmpty()">
					<s:iterator value="#session.userTextCompanyUndo" var="t">
						<table style="border-bottom: 1px dotted;width: 520px;">
							<tr>
								<td>求助内容:${text}<br> <br> 信用值:${transPoint}<br>
									<br> 有效截止至:<fmt:formatDate value="${limitDate}"
										pattern="yyyy-MM-dd HH:mm" /><br> <br>
									求助人:${userByUserSendId.userName}<br> <br>
									电话:${userByUserSendId.userTel}<br> <br>
								</td>
								<s:if test="#t.image!=null&&#t.image!='no'">
									<td style="width: 280px;" align="center"><img alt=" "
										src="${image}" style="width: 100px;height: 120px">
									</td>
								</s:if>
								<s:else>
									<td></td>
								</s:else>
								</tr>
								<tr style="height: 10px;"></tr>
								<tr>
									<td align="right" colspan="2"><a
										href="usertext_cancelTask?id=${textId}"
										class="buttonDeleteText">取消</a></td>
								</tr>
						</table>
					</s:iterator>
				</s:if>
				<s:else>
					<ul>
						<li>尚无未完成的任务</li>
					</ul>
				</s:else>
			</div>
			<div class="content" style="display: none;">
				<h3>已完成的任务</h3>
				<s:if
					test="#session.userTextCompanyDone!=null&& !#session.userTextCompanyDone.isEmpty()">
					<s:iterator value="#session.userTextCompanyDone" var="t">
						<table style="border-bottom: 1px dotted; width: 520px;">
							<tr>
								<td>求助内容:${text}<br> <br> 信用值:${transPoint}<br>
									<br> 有效截止至:<fmt:formatDate value="${limitDate}"
										pattern="yyyy-MM-dd HH:mm" />
								</td>
								<s:if test="#t.image!=null&&#t.image!='no'">
									<td style="width: 280px;" align="center"><img alt=" "
										src="${image}" style="width: 100px;height: 120px">
									</td>
								</s:if>
								<s:else>
									<td></td>
								</s:else>
						</table>
					</s:iterator>
				</s:if>
				<s:else>
					<ul>
						<li>尚无已完成的任务</li>
					</ul>
				</s:else>
			</div>
			<div class="content" style="display: none;">
				<h3>发布广告</h3>
				<form action="bothtext_addBothTextByCompany"
					id="addBothTextByCompany" method="post"
					enctype="multipart/form-data" class="Form"
					style="margin-top: 30px;width: 480px;">
					<ul>
						<li>广告内容:</li>
						<li><textarea name="bothText.text"
								onkeyup="checkLength1201(this);"
								style="width:470px;height:100px;">
								</textarea></li>
						<li style="margin-top: 90px;"><span class="wordage">剩余字数：<span
								id="sy1" style="color:Red;">120</span> </span>
						</li>
						<li style="margin-bottom: 5px;">有效期选择:<input type="text"
							onClick="WdatePicker()"
							onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm',minDate:'%y-%M-%d %H:{%m+10}',maxDate:'{%y+1}-%M-%d %H:%m',realDateFmt:'yyyy-MM-dd HH:mm'})"
							style="width: 150px;" name="limitday">
						</li>
						<li>需上传的图片:</li>
						<li><input type="file" name="image"></li>
						<li><input type="reset" value="重置内容" class="buttonReset">
							<s:if test="#session.company.tag!=0">
								<input type="submit" value="确认发布" class="buttonSubmit">
							</s:if> <s:else>
								<input type="button" value="确认发布" class="buttonReset"
									onclick="check5()">
							</s:else> </li>
					</ul>
				</form>
			</div>
		</div>
	</div>
	<s:debug></s:debug>
	<c:remove var="msg" scope="session" />
</body>
</html>
